package com.practice.selenium.driver;

import java.io.File;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.Augmenter;
import org.openqa.selenium.support.events.EventFiringWebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;

import com.practice.selenium.config.SeleniumConfig;

public class WebDriverUtil {
	
	public static final int VERSION_FIREFOX_SELENIUM_3 = 47;
	public static final int VERSION_SAFARI_SELENIUM_3 = 10;
	
	private static SeleniumConfig seleniumConfig = SeleniumConfig.load();

	public static EventFiringWebDriver createEventFiringWebDriver(WebDriver webDriver) {
		EventFiringWebDriver eventFiringWebDriver = new EventFiringWebDriver(webDriver);
		return eventFiringWebDriver;
	}
	
	public static WebDriverWait createWebDriverWait(WebDriver webDriver) {
		return new WebDriverWait(webDriver, 5);
	}
	
	public static void getScreenshot(WebDriver driver) {
		WebDriver augmentedDriver = new Augmenter().augment(driver);
		File screenshot = ((TakesScreenshot) augmentedDriver).getScreenshotAs(OutputType.FILE);
	}
	
}
